/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package controller;

import java.util.List;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.RequestScoped;
import service.Employee;
import service.ManagementService_Service;

/**
 *
 * @author Tien
 */
@ManagedBean
@RequestScoped
public class EmployeeBean {
    private List<Employee> employees;
    private String search;
    private ManagementService_Service service;

    public String getSearch() {
        return search;
    }

    public void setSearch(String search) {
        this.search = search;
    }

    public List<Employee> getEmployees() {
        return employees;
    }

    public void setEmployees(List<Employee> employees) {
        this.employees = employees;
    }
    /**
     * Creates a new instance of EmployeeBean
     */
    public EmployeeBean() {
        service = new ManagementService_Service();
        employees = service.getManagementServicePort().getAll();
    }
    
    public void search(){
        if(search != null){
            employees = service.getManagementServicePort().searchByName(search);
        }
    }
}
